@echo off
setlocal enabledelayedexpansion

rem 创建 lib 目录并下载 JUnit 平台独立包（包含运行所需全部依赖）
set LIB_DIR=%~dp0..\lib
if not exist "%LIB_DIR%" mkdir "%LIB_DIR%"

set JAR_NAME=junit-platform-console-standalone-1.10.2.jar
set JAR_PATH=%LIB_DIR%\%JAR_NAME%
set JAR_URL=https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/1.10.2/%JAR_NAME%

if exist "%JAR_PATH" (
    echo Found %JAR_NAME% in lib, skip download.
) else (
    echo Downloading %JAR_NAME% ...
    curl -L -o "%JAR_PATH" "%JAR_URL%"
    if errorlevel 1 (
        echo Failed to download %JAR_NAME%. Please check your network or install curl.
        exit /b 1
    )
)

echo Done. JUnit standalone jar is at %JAR_PATH%
exit /b 0


